package com.mlh.furn.bean;

import java.util.HashMap;
import java.util.Map;

//Msg:后端程序返回给前端的json数据的Msg对象
public class Msg {
	// 状态码，200 成功，400 失败
	private int code;
	// 信息
	private String msg;
	// 返回给浏览器的数据
	private Map<String, Object> extend = new HashMap<String, Object>();

	public static Msg success() {
		Msg res = new Msg();
		res.setCode(200);
		res.setMsg("success");
		return res;
	}
	public static Msg fail() {
		Msg res = new Msg();
		res.setCode(400);
		res.setMsg("fail");
		return res;
	}
	public Msg add(String key, Object value) {
		extend.put(key, value);
		return this;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Map<String, Object> getExtend() {
		return extend;
	}

	public void setExtend(Map<String, Object> extend) {
		this.extend = extend;
	}

}
